from django.conf.urls.defaults import *

from blog.feeds import LatestArchives
from blog.sitemaps import *
from blog.models import *

feeds = {
    'latest': LatestArchives,
}
#
#archive_map = {
#    'queryset': Archive.all(),
#    'date_field': 'pub_date',
#}
#
#sitemaps = {
#    'blog': GenericSitemap( archive_map ,priority=0.5),
#    'archive': ArchiveSitemap,
#}
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
__ROOT__ = os.path.dirname(__file__)

urlpatterns = patterns('',
    # Example:
    # (r'^waylybaye/', include('waylybaye.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/', include(admin.site.urls)),
    (r'^themes/(?P<path>.*)$','django.views.static.serve',
        {'document_root':__ROOT__ + '/themes'}),
    (r'^feeds/(?P<url>.*)$','django.contrib.syndication.views.feed',
        {'feed_dict':feeds}),

    (r'^sitemap.xml$','blog.sitemaps.index'),
    #(r'^sitemap.xml$',      'django.contrib.sitemaps.views.index',
    #    {'sitemaps' :sitemaps}),
    #(r'^sitemap-(?P<section>.+).xml$',
    #    'django.contrib.sitemaps.views.sitemap',
    #    {'sitemaps' :sitemaps}),

    (r'^$','blog.views.index'),
    (r'^category/(\w+)/edit$', 'blog.views.edit_category'),
    (r'^category/(\w+)$','blog.views.category'),
    (r'^category$'      ,'blog.views.add_category'),

    (r'tag/(\w+)$'      ,'blog.views.tag'),
    
    (r'^mblog$',         'blog.views.add_mblog'),

    (r'^archive/(\d+)/(next|prev)$', 'blog.views.archive_nav'),
    (r'^archive/(\d+)/comment$',    'blog.views.add_comment'),
    (r'^archive/(\d+)/edit$',       'blog.views.edit_archive'),
    (r'^archive/(\d+)/delete$',      'blog.views.delete_archive'),
    (r'^archive/(\d+)$','blog.views.archive'),
    (r'^archive$'       ,'blog.views.add_archive'),

    (r'^sidebar$',      'blog.views.sidebar'),
    (r'^upload$',       'blog.views.upload'),
    (r'^image/(.+)$',   'blog.views.image'),
    (r'^login$',        'blog.views.login'),
    (r'^admin$',        'blog.views.admin'),
    (r'^admin/(?P<tab>blog|author)$',   'blog.views.admin'),

    (r'^not_found$',    'blog.views.not_found'),

    (r'^wap$',                  'blog.wap.index'),
    (r'^wap/archives$',         'blog.wap.archives'),
    (r'^wap/comments$',         'blog.wap.comments'),
    (r'^wap/archive/(\d+)$',    'blog.wap.archive'),
    (r'^wap/archive/(\d+)/comment$','blog.wap.add_comment'),
    (r'^wap/category/(\w+)$',   'blog.wap.category'),
    (r'^wap/not_found$',        'blog.wap.not_found'),

    (r'^test$',                 'blog.views.test'),
)
